package assists
{
	import flash.filesystem.File;

	public class CheckFileExist
	{	
		public static function fileExist(fileName:String):Boolean
		{
			var _file:File;
			var _filesList:Array = [];
			
			if(fileName == null) return false;
			if(!_file)
			{
				_file = File.documentsDirectory.resolvePath("iWeiHai");
				
				if(_file.exists == false)
				{
					return false;
				}
			}
			if(!_filesList)
			{
				_filesList = _file.getDirectoryListing();
				var tmp:File;
				for(var i:int=0;i<_filesList.length;i++)
				{
					tmp = _filesList[i];
					if(tmp.name == fileName)
					{
						return true;
					}
					trace("fileName:" + tmp.name);
				}
			}
			return false;
		}
	}
}